import pandas as pd
import datetime
import matplotlib.pyplot as plt

data = pd.read_excel('2021MCMProblemC2.xlsx')

'''
def toNum(x):
    if isinstance(x,datetime.datetime):
        return x.timestamp()
    else:
        print(x)
        return None

data['Detection Date']=data['Detection Date'].map(toNum)
data['Detection Date']/=100
a=data['Detection Date'].tolist()
print(max(a),min(a))
'''


def toStr(month):
    if month < 10:
        strMonth = '0' + str(month)
        s_date = datetime.datetime.strptime('2019' + strMonth + '01', '%Y%m%d').date()
    else:
        s_date = datetime.datetime.strptime('2019' + str(month) + '01', '%Y%m%d').date()
    return s_date

month=1
while month<=11:
    s_date=toStr(month)
    e_date=toStr(month+1)

    df = data[(data['Detection Date'] >= s_date) & (data['Detection Date'] < e_date) & (data['Lab Status'] == 'Unverified')]
    plt.scatter(df['Latitude'].tolist(), df['Longitude'].tolist())
    df = data[(data['Detection Date'] >= s_date) & (data['Detection Date'] < e_date) & (data['Lab Status'] == 'Positive ID')]
    plt.scatter(df['Latitude'].tolist(), df['Longitude'].tolist())
    plt.show()

    month+=1

s_date=toStr(12)
e_date=datetime.datetime.strptime('20191231', '%Y%m%d').date()
df = data[(data['Detection Date'] >= s_date) & (data['Detection Date'] <= e_date)]
plt.scatter(df['Latitude'].tolist(), df['Longitude'].tolist())
df = data[(data['Detection Date'] >= s_date) & (data['Lab Status'] == 'Positive ID')]
plt.scatter(df['Latitude'].tolist(), df['Longitude'].tolist())
plt.show()